<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
    <xsl:output method="html" indent="yes" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"/>

		
  <xsl:template match="/root">
      
      <html>
          <head>
              <title>Client Report</title>
              <meta http-equiv="Content-Language" content="en-us" />
              <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
          </head>

          <style>
			  body {
			  font-family: Arial, Sans-Serif;
			  color: #666666;
			  font-size: 13px;
			  margin: 15px;
			  }
			  table {
			  font-family: Arial, Sans-Serif;
			  color: #666666;
			  font-size: 13px;
			  }
			  th {
			  font-weight: bold;
			  text-align: left;
			  padding-bottom: 5px;
			  }
			  A:link, A:visited, A:active {
			  text-decoration: underline;
			  color: #186bb8;
			  }
			  A:hover {
			  text-decoration: underline;
			  color: #990000;
			  }
			  .Espace_ClientContainer {
			  width: 800px;
			  }
			  .Espace_ClientTitle {
			  font-size: 20px;
			  font-weight: bold;
			  }
			  .Espace_ClientDiv {
			  background-color: #858585;
			  color: white;
			  font-size: 16px;
			  font-weight: bold;
			  margin: 15px 0;
			  padding: 5px;
			  }
			  .Espace_ClientDiv_Red {
			  background-color: #bdcd00;
			  color: white;
			  font-size: 16px;
			  font-weight: bold;
			  margin: 15px 0;
			  padding: 5px;
			  }
			  .Espace_ClientBold {
			  font-weight: bold;
			  text-align: right;
			  }
			  .Espace_ClientNormal {
			  padding-left: 5px;
			  }
			  .Espace_ClientProject {
			  margin-bottom: 15px;
			  width: 600px;
			  }
			  .Espace_ClientSubStatus {
			  background-color: #f0f0f0;
			  width: 400px;
			  }
			  .Espace_ClientStatusLeft {
			  font-weight: bold;
			  text-align: right;
			  padding-right: 5px;
			  width: 100px;
			  }
			  .Espace_ClientStatusRight {
			  font-weight: bold;
			  font-size: 10px;
			  padding-left: 5px;
			  width: 100px;
			  }
			  .Espace_ClientButton {
			  margin-top: 5px;
			  text-align: right;
			  }
			  .Espace_ClientProjectDiv {
			  background-color: #f0f0f0;
			  font-size: 12px;
			  font-weight: bold;
			  margin: 10px 0;
			  padding: 4px;
			  }
		  </style>

          <body>

              <div class="Espace_ClientContainer">
    <div class="Espace_ClientTitle">
      <xsl:value-of select="settings/genxml/textbox/txtclientreporttitle"/>
    </div>
    <div class="Espace_ClientDiv">Profile</div>
    <div>
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td class="Espace_ClientBold">Client Ref : </td>
          <td class="Espace_ClientNormal">
            <xsl:value-of select="client/item/xmldata/genxml/textbox/txtclientref"/>
          </td>
          <td class="Espace_ClientBold">Address : </td>
          <td class="Espace_ClientNormal">
            <xsl:value-of select="client/item/xmldata/genxml/textbox/txtclientadd1"/>
          </td>
        </tr>
        <tr>
          <td class="Espace_ClientBold"></td>
          <td>
          </td>
          <td class="Espace_ClientBold"></td>
          <td class="Espace_ClientNormal">
            <xsl:value-of select="client/item/xmldata/genxml/textbox/txtclientadd2"/>
          </td>
        </tr>
        <tr>
          <td class="Espace_ClientBold">Client Name : </td>
          <td class="Espace_ClientNormal">
            <xsl:value-of select="client/item/xmldata/genxml/textbox/txtclientname"/>
          </td>
          <td class="Espace_ClientBold">Post Code : </td>
          <td class="Espace_ClientNormal">
            <xsl:value-of select="client/item/xmldata/genxml/textbox/txtclientpc"/>
          </td>
        </tr>
        <tr>
          <td class="Espace_ClientBold">Company Name : </td>
          <td class="Espace_ClientNormal">
            <xsl:value-of select="client/item/xmldata/genxml/textbox/txtcompanyname"/>
          </td>
          <td class="Espace_ClientBold">Town : </td>
          <td class="Espace_ClientNormal">
            <xsl:value-of select="client/item/xmldata/genxml/textbox/txtclientadd3"/>
          </td>
        </tr>
        <tr>
          <td class="Espace_ClientBold">SIRET : </td>
          <td class="Espace_ClientNormal">
            <xsl:value-of select="client/item/xmldata/genxml/textbox/txtsiret"/>
          </td>
          <td class="Espace_ClientBold">Tel1 : </td>
          <td class="Espace_ClientNormal">
            <xsl:value-of select="client/item/xmldata/genxml/textbox/txttel1"/>
          </td>
        </tr>
        <tr>
          <td class="Espace_ClientBold">Tax No.</td>
          <td class="Espace_ClientNormal">
            <xsl:value-of select="client/item/xmldata/genxml/textbox/txttva"/>
          </td>
          <td class="Espace_ClientBold">Tel2 : </td>
          <td class="Espace_ClientNormal">
            <xsl:value-of select="client/item/xmldata/genxml/textbox/txttel2"/>
          </td>
        </tr>
        <tr>
          <td></td>
          <td>
          </td>
          <td class="Espace_ClientBold">Email : </td>
          <td class="Espace_ClientNormal">
            <xsl:value-of select="client/item/xmldata/genxml/textbox/txtpersonalemail"/>
          </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td></td>
          <td></td>
        </tr>
      </table>
    </div>

    <xsl:if test="/root/outstanding/total > 0">
    <div class="Espace_ClientDiv_Red">Payments Due</div>
    <table width="500" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <th>Invoice Ref</th>
        <th>Due Date</th>
        <th class="Espace_ClientBold">Amount</th>
        <th class="Espace_ClientBold">Paid</th>
        <th class="Espace_ClientBold">Due</th>
      </tr>
      <xsl:for-each select="/root/outstanding/item">
          <tr>
          <td>
            <xsl:value-of select="xmldata/genxml/hidden/invoiceref"/>
          </td>
          <td>
            <xsl:call-template name="FormatDate"><xsl:with-param name="DateTime" select="xmldata/genxml/hidden/dtedate"/></xsl:call-template>
          </td>
            <td align="right">
              <xsl:value-of select="format-number(translate(xmldata/genxml/hidden/dbldue,',',''), '######0.00')"/>
            </td>
            <td align="right">
              <xsl:if test="xmldata/genxml/hidden/dblactualpaid != ''">
                <xsl:value-of select="format-number(translate(xmldata/genxml/hidden/dblactualpaid,',',''), '######0.00')"/>
              </xsl:if>
            </td>
            <td align="right">
              <xsl:if test="xmldata/genxml/hidden/dblactualpaid = ''">
                <xsl:value-of select="format-number(translate(xmldata/genxml/hidden/dbldue,',',''), '######0.00')"/>
              </xsl:if>
              <xsl:if test="xmldata/genxml/hidden/dblactualpaid != ''">
                <xsl:value-of select="format-number(translate(xmldata/genxml/hidden/dbldue,',','') - translate(translate(xmldata/genxml/hidden/dblactualpaid,',',''),' ',''), '######0.00')"/>
              </xsl:if>
            </td>
          </tr>
      </xsl:for-each>
    </table>
    <div class="Espace_ClientButton">
      <a target="_blank">
	  <xsl:if test="/root/outstanding/total != '0'">
      <xsl:if test="settings/genxml/textbox/txtpaymentlink != ''">
        <xsl:attribute name="href">
          <xsl:value-of select="settings/genxml/textbox/txtpaymentlink"/>
          <xsl:if test="settings/genxml/checkbox/chkaddpayamt='True'">
            <xsl:value-of select="/root/outstanding/total"/>
          </xsl:if>
        </xsl:attribute>
      </xsl:if>
      <xsl:text>Pay Outstanding Balance of </xsl:text><b><xsl:value-of select="format-number(/root/outstanding/total, '0.00')"/><xsl:text> euro</xsl:text></b>
	  </xsl:if>
      </a>
    </div>
    </xsl:if>


    <div class="Espace_ClientDiv">Projects</div>
    <xsl:for-each select="/root/project/item">
    <table border="0" cellpadding="0" cellspacing="0" class="Espace_ClientProject">
        <tr>
			<td colspan="3">
				<div class="Espace_ClientProjectDiv">		  
            <b><xsl:value-of select="xmldata/genxml/textbox/txtprojectname"/></b>
			</div>
				<xsl:if test="xmldata/genxml/checkbox/chkdepositnotpaid = 'True'">
					<b>Please arrange for your deposit to be paid.</b>
					<br/>
					<br/>
				</xsl:if>
			</td>
          </tr>

		<tr>
			<td class="Espace_ClientStatusLeft">
				<xsl:text></xsl:text>
			</td>
			<td>
				<div>
					<xsl:choose>
						<xsl:when test="xmldata/genxml/radiobuttonlist/rblstatus=1">
							<font color="red">
								<xsl:text>High Priority</xsl:text>
							</font>
						</xsl:when>
						<xsl:when test="xmldata/genxml/radiobuttonlist/rblstatus=4">
							<font color="blue">
								<xsl:text>Project is Waiting for client</xsl:text>
							</font>
						</xsl:when>
						<xsl:when test="xmldata/genxml/radiobuttonlist/rblstatus=6">
							<font color="green">
								<xsl:text>Project Proceeding</xsl:text>
							</font>
						</xsl:when>
						<xsl:when test="xmldata/genxml/radiobuttonlist/rblstatus=18">
							<font color="#cc6600">
								<xsl:text>Project On Hold</xsl:text>
							</font>
						</xsl:when>
						<xsl:when test="xmldata/genxml/radiobuttonlist/rblstatus=20">
							<font color="#cc6600">
								<xsl:text>Project Completed</xsl:text>
							</font>
						</xsl:when>
						<xsl:otherwise>
							<xsl:text>Unknown</xsl:text>
						</xsl:otherwise>
					</xsl:choose>

				</div>
			</td>
			<td class="Espace_ClientStatusRight">
			</td>
		</tr>

		<tr>
          <td class="Espace_ClientStatusLeft">
            <xsl:text>Progress : </xsl:text>
          </td>
          <td class="Espace_ClientSubStatus">
            <div>
              <xsl:attribute name="style">
                z-index: 1;
                width: <xsl:value-of select="xmldata/genxml/textbox/txtoverallprogress * 4"/>px;
                height: 10px;
                background-color:#336699;
                layer-background-color:#336699;
                visibility: visible
              </xsl:attribute>
            </div>
          </td>
          <td class="Espace_ClientStatusRight">
          <xsl:value-of select="xmldata/genxml/textbox/txtoverallprogress"/>
          <xsl:text>%</xsl:text>
          </td>
        </tr>

		<tr>
          <td colspan="3">
			  <br/>
			  <i><xsl:value-of select="xmldata/genxml/textbox/txttaskdesc"/></i>
			  <br/>
			  <p>
				  <xsl:value-of select="xmldata/genxml/textbox/txtcomments"/>
			  </p>
		  </td>
          </tr>
</table>
      </xsl:for-each>


    <div class="Espace_ClientDiv">Websites</div>
				  <table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <th>Name</th>
        <th>Primary URL</th>
        <th>Renewal Date</th>
        <th></th>
      </tr>
      <xsl:for-each select="/root/website/item">
		  <xsl:if test="xmldata/genxml/checkbox/chkcontractout = 'True'">
			  <tr>
				  <td colspan="4">
					  <b>Please sign and return your contract.</b>
				  </td>
			  </tr>
		  </xsl:if>
		  <tr>
        <td width="175px">
          <xsl:value-of select="xmldata/genxml/textbox/txtwebsitename"/>
        </td>
        <td width="175px">
          <xsl:value-of select="xmldata/genxml/hidden/txtprimaryurl"/>
        </td>
        <td width="250px">
          <xsl:call-template name="FormatDate">
            <xsl:with-param name="DateTime" select="xmldata/genxml/textbox/daterenewal"/>
          </xsl:call-template>
        </td>
          <td>
          <a target="_blank">
            <xsl:attribute name="href">
				<xsl:text>http://www.google.com/analytics/</xsl:text>
            </xsl:attribute>
            <xsl:text>Statistics</xsl:text>
          </a>
          </td>
        </tr>
     </xsl:for-each>
   </table>

    <div class="Espace_ClientDiv">Domains</div>
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <th>Url</th>
        <th>Renewal</th>
        <th>Cost per year</th>
      </tr>
      <xsl:for-each select="/root/urls/item">
        <tr>
        <td valign="top">
          <xsl:value-of select="xmldata/genxml/textbox/txturl"/>
          <xsl:if test="xmldata/genxml/textbox/txturlredirect!=''">
            <xsl:text> > </xsl:text>
            <xsl:value-of select="xmldata/genxml/textbox/txturlredirect"/>
          </xsl:if>
        </td>
          <td valign="top">
            <xsl:call-template name="FormatDate">
              <xsl:with-param name="DateTime" select="xmldata/genxml/textbox/dateclientrenew"/>
            </xsl:call-template>
          </td>
          <td valign="top">
            <xsl:value-of select="xmldata/genxml/textbox/txtprice"/>
          </td>
        </tr>
      </xsl:for-each>
    </table>

    <div class="Espace_ClientDiv">Emails</div>
    <table border="0" cellpadding="0" cellspacing="0" width="500">
      <tr>
        <th>Email</th>
        <th></th>
        <th>Redirect</th>
      </tr>
      <xsl:for-each select="/root/urls/item">
            <xsl:for-each select="urlsemail/item">
              <tr>
                <td>
                  <xsl:value-of select="xmldata/genxml/textbox/txtfromemail"/>
              <xsl:text>@</xsl:text>
              <xsl:value-of select="substring-after(xmldata/genxml/hidden/liveurlonemail,'.')"/>
                </td>
                <td>
                  <xsl:text>></xsl:text>
                </td>
                <td>
                  <xsl:value-of select="xmldata/genxml/textbox/txttoemail"/>
                </td>
              </tr>
            </xsl:for-each>
      </xsl:for-each>
    </table>

</div>

          </body>

      </html>

</xsl:template>


  <xsl:template name="FormatDate">

    <xsl:param name="DateTime" />

    <!-- new date format 2006-01-14T08:55:22 -->

    <xsl:variable name="mo">
      <xsl:value-of select="substring($DateTime,6,2)" />
    </xsl:variable>
    <xsl:variable name="day">
      <xsl:value-of select="substring($DateTime,9,2)" />
    </xsl:variable>
    <xsl:variable name="year">
      <xsl:value-of select="substring($DateTime,1,4)" />
    </xsl:variable>
    <xsl:value-of select="$day"/>
    <xsl:text>/</xsl:text>
    <xsl:value-of select="$mo"/>
    <xsl:text>/</xsl:text>
    <xsl:value-of select="$year"/>

  </xsl:template>

</xsl:stylesheet>
